interface Shape {
    draw(): void;
}

class Rectangle implements Shape {
    public draw(): void {
        console.log('▲');
    };
}

class Square implements Shape {
    public draw(): void {
        console.log('□');
    };
}

class Circle implements Shape {
    public draw(): void {
        console.log('o');
    };
}

class ShapeFactory {
    public getShape(shapeType: string): Shape | null {
        if (shapeType === null) {
            return null;
        }
        switch (shapeType.toLowerCase()) {
            case 'circle':
                return new Circle();
            case 'square':
                return new Square();
            case 'rectangle':
                return new Rectangle();
            default:
                return null;
        }
    }
}

function main() {
    const sf: ShapeFactory = new ShapeFactory();
    const s1: Shape = sf.getShape('CIRCLE') as Shape;
    s1.draw();
    const s2: Shape = sf.getShape('RECTANGLE') as Shape;
    s2.draw();
    const s3: Shape = sf.getShape('SQUARE') as Shape;
    s3.draw();
}

main();
